import App from './App'
import store from '@/store/index.js'
// #ifndef VUE3
import Vue from 'vue'
import uView from '@/uni_modules/uview-ui'
import {
	initToken,
	getNestInfoList
} from "./api/index.js"
import api from "./websocket/utils/url";
import mywebsocket from "./websocket/connector";
import orangeUtil from './js_sdk/orange-util/orange-util.js'; //orange-util.js 所在文件目录
Vue.use(orangeUtil);
Vue.use(uView)
Vue.prototype.$store = store

let amapFile = require('@/common/amap-wx.js');
Vue.prototype.myAmapFun = new amapFile.AMapWX({
	key: '999707d70482af6e7b58fadcaf236813'
});
initToken()
// console.log(uni.getStorageSync('userInfo'), 'userInfo')
if (uni.getStorageSync('userInfo')) {} else {
	uni.navigateTo({
		url: "loginPages/login/login"
	})
}
// const gavNestInfo = (await getNestInfoList()).data.data.list;
getNestInfoList().then(res => {
	store.commit("smartFlight/setGvaNestInfoList", res.data.data.list);
	console.log(res.data.data.list, 'ressss')
})
// console.log("smartFlight/setGvaNestInfoList", gavNestInfo);

store.dispatch("initMachineList")
import title from "component/title.vue"
Vue.component('title', title)
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
let v4 = app.$util.uuid()
mywebsocket.setupWebSocket(api.nestChannel + "?nestid=all&clientid=" + v4);

// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif